I tried my best to get it reproduced with the binary ES install, but whatever I do on my side I land correctly at "Teenage Mutant..." which is the first with "T" (in Arcade) and at "Tecmo Bowl" (first with "T" in "NES" and "All Games").
As it is non-deterministic on your side I am leaning towards the hardware and maybe in conjunction with "ThreadedLoading" value="true" but it is a vague guess.
If you have the patience, you may install the whole shebang Retropie on your Desktop or in a Linux VM or if you have a spare Pi4 at hand use that. If it also happens on a different RetroPie installation it indicates something with the filestructure/gamelist data, if not then the plot thickens that it might be hardware related.